package com.lineage.data.item_etcitem.event;

import com.lineage.data.executor.ItemExecutor;
import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_ServerMessage;
import com.lineage.server.serverpackets.ServerBasePacket;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Item_Mazu extends ItemExecutor {
  private static final Log _log = LogFactory.getLog(Item_Mazu.class);
  
  public static ItemExecutor get() {
    return new Item_Mazu();
  }
  
  public void execute(int[] data, L1PcInstance pc, L1ItemInstance item) {
    try {
      if (item == null)
        return; 
      if (pc == null)
        return; 
      if (pc.hasSkillEffect(8591)) {
        int i = pc.getSkillEffectTimeSec(8591);
        pc.sendPackets((ServerBasePacket)new S_ServerMessage("妈祖的祝福效果剩余时间(秒):" + i));
        return;
      } 
      int time = 1800;
      pc.setSkillEffect(8591, 1800000);
      pc.getInventory().removeItem(item, 1L);
      pc.sendPackets((ServerBasePacket)new S_ServerMessage("感受到妈祖的祝福"));
    } catch (Exception e) {
      _log.error(e.getLocalizedMessage(), e);
    } 
  }
}
